package com.thinkit.bigdata.web.service.impl.sys;

import com.thinkit.bigdata.core.feature.orm.mybatis.Page;
import com.thinkit.bigdata.web.dao.sys.SysConfigMapper;
import com.thinkit.bigdata.web.model.sys.SysConfig;
import com.thinkit.bigdata.web.model.sys.SysConfigExample;
import com.thinkit.bigdata.web.service.sys.SysConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by lihongli on 2018/9/4
 */
@Service
public class SysConfigServiceImpl implements SysConfigService {

    @Resource
    private SysConfigMapper mapper;

    @Override
    public List<SysConfig> selectByExample(Page<SysConfig> page, SysConfigExample example) {
        return mapper.selectByExample(page, example);
    }

    @Override
    public Integer insert(SysConfig record) {
        return mapper.insertSelective(record);
    }

    @Override
    public Integer update(SysConfig record) {
        return mapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public Integer countByExample(SysConfigExample example) {
        return mapper.countByExample(example);
    }

    @Override
    public SysConfig sysConfigGetByPK(String code) {
        return mapper.selectByPrimaryKey(code);
    }

    @Override
    public Integer delete(String code) {
        return mapper.deleteByPrimaryKey(code);
    }

    @Override
    public Integer delete(List<String> codeList) {
        int rowNum = 0;
        for (String code : codeList) {
            rowNum += mapper.deleteByPrimaryKey(code);
        }
        return rowNum;
    }
}
